<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>GIMPLE API (GNU Compiler Collection (GCC) Internals)</title>

<meta name="description" content="GIMPLE API (GNU Compiler Collection (GCC) Internals)">
<meta name="keywords" content="GIMPLE API (GNU Compiler Collection (GCC) Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Option-Index.html" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Match-and-Simplify.html" rel="up" title="Match and Simplify">
<link href="The-Language.html" rel="next" title="The Language">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>


</head>

<body lang="en">
<div class="section-level-extent" id="GIMPLE-API">
<div class="nav-panel">
<p>
Next: <a href="The-Language.html" accesskey="n" rel="next">The Language</a>, Up: <a href="Match-and-Simplify.html" accesskey="u" rel="up">Match and Simplify</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="GIMPLE-API-1"><span>26.1 GIMPLE API<a class="copiable-link" href="#GIMPLE-API-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-GIMPLE-API"></a>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-gimple_005fsimplify"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_simplify</strong> <code class="def-code-arguments">(enum tree_code, tree, tree, gimple_seq *, tree (*)(tree))</code><a class="copiable-link" href="#index-gimple_005fsimplify"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-gimple_005fsimplify-1"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_simplify</strong> <code class="def-code-arguments">(enum tree_code, tree, tree, tree, gimple_seq *, tree (*)(tree))</code><a class="copiable-link" href="#index-gimple_005fsimplify-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-gimple_005fsimplify-2"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_simplify</strong> <code class="def-code-arguments">(enum tree_code, tree, tree, tree, tree, gimple_seq *, tree (*)(tree))</code><a class="copiable-link" href="#index-gimple_005fsimplify-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-gimple_005fsimplify-3"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_simplify</strong> <code class="def-code-arguments">(enum built_in_function, tree, tree, gimple_seq *, tree (*)(tree))</code><a class="copiable-link" href="#index-gimple_005fsimplify-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-gimple_005fsimplify-4"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_simplify</strong> <code class="def-code-arguments">(enum built_in_function, tree, tree, tree, gimple_seq *, tree (*)(tree))</code><a class="copiable-link" href="#index-gimple_005fsimplify-4"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-gimple_005fsimplify-5"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_simplify</strong> <code class="def-code-arguments">(enum built_in_function, tree, tree, tree, tree, gimple_seq *, tree (*)(tree))</code><a class="copiable-link" href="#index-gimple_005fsimplify-5"> &para;</a></span></dt>
<dd><p>The main GIMPLE API entry to the expression simplifications mimicking
that of the GENERIC fold_{unary,binary,ternary} functions.
</p></dd></dl>

<p>thus providing n-ary overloads for operation or function.  The
additional arguments are a gimple_seq where built statements are
inserted on (if <code class="code">NULL</code> then simplifications requiring new statements
are not performed) and a valueization hook that can be used to
tie simplifications to a SSA lattice.
</p>
<p>In addition to those APIs <code class="code">fold_stmt</code> is overloaded with
a valueization hook:
</p>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_0028gimple_005fstmt_005fiterator"><span class="category-def">bool: </span><span><code class="def-type">fold_stmt</code> <strong class="def-name">(gimple_stmt_iterator</strong> <code class="def-code-arguments">*, tree (*)(tree));</code><a class="copiable-link" href="#index-_0028gimple_005fstmt_005fiterator"> &para;</a></span></dt>
</dl>


<p>On top of these a <code class="code">fold_buildN</code>-like API for GIMPLE is introduced:
</p>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-gimple_005fbuild"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_build</strong> <code class="def-code-arguments">(gimple_seq *, location_t, enum tree_code, tree, tree, tree (*valueize) (tree) = NULL);</code><a class="copiable-link" href="#index-gimple_005fbuild"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-gimple_005fbuild-1"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_build</strong> <code class="def-code-arguments">(gimple_seq *, location_t, enum tree_code, tree, tree, tree, tree (*valueize) (tree) = NULL);</code><a class="copiable-link" href="#index-gimple_005fbuild-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-gimple_005fbuild-2"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_build</strong> <code class="def-code-arguments">(gimple_seq *, location_t, enum tree_code, tree, tree, tree, tree, tree (*valueize) (tree) = NULL);</code><a class="copiable-link" href="#index-gimple_005fbuild-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-gimple_005fbuild-3"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_build</strong> <code class="def-code-arguments">(gimple_seq *, location_t, enum built_in_function, tree, tree, tree (*valueize) (tree) = NULL);</code><a class="copiable-link" href="#index-gimple_005fbuild-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-gimple_005fbuild-4"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_build</strong> <code class="def-code-arguments">(gimple_seq *, location_t, enum built_in_function, tree, tree, tree, tree (*valueize) (tree) = NULL);</code><a class="copiable-link" href="#index-gimple_005fbuild-4"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-gimple_005fbuild-5"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_build</strong> <code class="def-code-arguments">(gimple_seq *, location_t, enum built_in_function, tree, tree, tree, tree, tree (*valueize) (tree) = NULL);</code><a class="copiable-link" href="#index-gimple_005fbuild-5"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-gimple_005fconvert"><span class="category-def">GIMPLE function: </span><span><code class="def-type">tree</code> <strong class="def-name">gimple_convert</strong> <code class="def-code-arguments">(gimple_seq *, location_t, tree, tree);</code><a class="copiable-link" href="#index-gimple_005fconvert"> &para;</a></span></dt>
</dl>

<p>which is supposed to replace <code class="code">force_gimple_operand (fold_buildN (...), ...)</code>
and calls to <code class="code">fold_convert</code>.  Overloads without the <code class="code">location_t</code>
argument exist.  Built statements are inserted on the provided sequence
and simplification is performed using the optional valueization hook.
</p>

</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="The-Language.html">The Language</a>, Up: <a href="Match-and-Simplify.html">Match and Simplify</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
